home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 479 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: reuna.cl!utfsm!vonbrand
  2. From: vonbrand@pincoya.inf.utfsm.cl (Horst von Brand)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Simplistic cin Question
  5. Date: 4 Jan 1996 16:50:14 -0300
  6. Organization: Departamento de Informatica, Universidad Tecnica Federico Santa Maria
  7. Message-ID: <4chb1m$16k@pincoya.inf.utfsm.cl>
  8. References: <4bedim$ol3@sage.cc.purdue.edu>
  9. NNTP-Posting-Host: pincoya.inf.utfsm.cl
  10.  
  11. In article <4bedim$ol3@sage.cc.purdue.edu>,
  12. Steve Mancini <mancinis@sage.cc.purdue.edu> wrote:
  13. >[How to read in something like:]
  14.  
  15. > 14     142616  N    37flr_reducer_clib.prt.1          33-16 T2
  16. > 65     150911  U    37flr_sto_con_clib.prt.7         33-01 T2
  17. > 62     409213  U    37flr_sto_elbow_clib.prt.22         33-06 T2&6
  18. >  2     144998  U    7t1099_weldlink_clib.prt.8         None
  19. > 96     217743  U    bolt_12pthd_i_a516.prt.18        23-78
  20.  
  21. >[Problem at the third line, reading 2 int, char, 2 char[] ]
  22.  
  23. Easy: The first 3 lines have 6 fields, the others 5 :-).  Make sure you
  24. read the line into a buffer and parse it from there, that way leftover
  25. garbage can't affect you; and you have a easier time handling short lines.
  26. -- 
  27. Dr. Horst H. von Brand                          vonbrand@inf.utfsm.cl
  28. Departamento de Informatica                     Fono: +56 32 626364 x 431
  29. Universidad Tecnica Federico Santa Maria        Fax:  +56 32 625217
  30. Casilla 110-V, Valparaiso, Chile
  31.